﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Xml.Linq;

namespace WebSE
{
    public partial class Register : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {

        }

        protected void Button1_Click(object sender, EventArgs e)
        {
            if (TextBoxPassword.Text != TextBoxRepeatPassword.Text)
            {
                Response.Write("您两次输入的密码不一样，请重新输入");
                return;
            }
            MembershipCreateStatus ms;
            MembershipUser newuser = Membership.CreateUser(
                    TextBoxName.Text, TextBoxPassword.Text,
                    TextBoxEmail.Text, TextBoxPasswordQuestion.Text,
                    TextBoxAnswer.Text, true, out ms);
            if (ms == MembershipCreateStatus.Success)
            {
                //ProfileCommon p = (ProfileCommon)ProfileCommon.Create(newuser.UserName, true);
                //p.RealName = TextBox12.Text;
                //p.IdCardNum = TextBox11.Text;
                //p.Address = TextBox7.Text;
                //p.ZipCode = TextBox8.Text;
                //p.Telephone = TextBox9.Text;
                //p.CellPhone = TextBox13.Text;
                //CUserData userData = new CUserData();
                //userData.str = "ABC";
                //p.UserData = userData;
                //p.Score = 0;
                //p.QQ = TextBox10.Text;
                //p.MSN = TextBox14.Text;
                //p.Hobby = TextBox15.Text;
                //p.Birthday = TextBox16.Text;
                //p.ExchangeGo = true;
                //p.Save();
                //Roles.AddUserToRole(TextBox1.Text, "members");
                //Response.Redirect("~/Succeed.aspx?text=恭喜你，注册成功！点击这里立刻登录！&url=~/Login.aspx");
                Response.Write("恭喜你，注册成功！");
            }
            else
            {
                //Response.Redirect("~/Fail.aspx?reason=" + ms.ToString());
                Response.Write(ms.ToString());
            }
        }
    }
}
